/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.cinfo.siga.datos;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.Transient;

/**
 *
 * @author lartkma
 */
@Embeddable
public class ProgramaModuloPK implements Serializable {
    @Basic(optional = false)
    @Column(name = "PRO_COD")
    private int proCod;
    @Basic(optional = false)
    @Column(name = "MOD_COD")
    private int modCod;
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);

    public ProgramaModuloPK() {
    }

    public ProgramaModuloPK(int proCod, int modCod) {
        this.proCod = proCod;
        this.modCod = modCod;
    }

    public int getProCod() {
        return proCod;
    }

    public void setProCod(int proCod) {
        int old = this.proCod;
        this.proCod = proCod;
        changeSupport.firePropertyChange("proCod", old, proCod);
    }

    public int getModCod() {
        return modCod;
    }

    public void setModCod(int modCod) {
        int old = this.modCod;
        this.modCod = modCod;
        changeSupport.firePropertyChange("modCod", old, modCod);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) proCod;
        hash += (int) modCod;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ProgramaModuloPK)) {
            return false;
        }
        ProgramaModuloPK other = (ProgramaModuloPK) object;
        if (this.proCod != other.proCod) {
            return false;
        }
        if (this.modCod != other.modCod) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.unmsm.cinfo.siga.datos.ProgramaModuloPK[ proCod=" + proCod + ", modCod=" + modCod + " ]";
    }
    
        public void addPropertyChangeListener(PropertyChangeListener l){
        changeSupport.addPropertyChangeListener(l);
    }
    
    public void removePropertyChangeListener(PropertyChangeListener l){
        changeSupport.removePropertyChangeListener(l);
    }
    
}
